package com.jz.community.moduleshoppingguide.neighbor.presenter;

import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.moduleshoppingguide.neighbor.bean.CircleUserInfoBean;
import com.jz.community.moduleshoppingguide.neighbor.model.NeighborModel;
import com.jz.community.moduleshoppingguide.neighbor.model.NeighborModelImp;
import com.jz.community.moduleshoppingguide.neighbor.ui.NeighborPersonInfoView;

public class NeighborPersonInfoPresenter extends BaseLifeCyclePresent<NeighborPersonInfoView.View> implements NeighborPersonInfoView.Presenter {

    private NeighborPersonInfoView.View view;
    private NeighborModel neighborModel;

    public NeighborPersonInfoPresenter(NeighborPersonInfoView.View view) {
        this.view = view;
        this.neighborModel = new NeighborModelImp(view.getContext());
    }


    @Override
    public void initUserInfo(String userId) {
        neighborModel.initUserInfo(userId, new OnLoadListener<CircleUserInfoBean>() {
            @Override
            public void onSuccess(CircleUserInfoBean circleUserInfoBean) {
                view.setInfoData(circleUserInfoBean);
            }

            @Override
            public void onFail(String msg, int code) {
                view.showError(msg);

            }
        });

    }
}
